package com.example.kingweather.activity;

import android.os.Bundle;

import com.example.kingweather.R;
import com.example.kingweather.adapter.ViewPagerAdapter;
import com.example.kingweather.fragment.WeatherFragment;

import java.util.ArrayList;
import java.util.List;

import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;

public class WeatherActivity extends AppCompatActivity {


    @BindView(R.id.view_pager)
    ViewPager viewPager;
    private List<Fragment> fragments;
    private ViewPagerAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_weather);
        ButterKnife.bind(this);

        WeatherFragment fragment=new WeatherFragment();
        fragments=new ArrayList<>();
        fragments.add(fragment);

        adapter = new ViewPagerAdapter(getSupportFragmentManager(),fragments);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(0);

    }
}
